package zut.cs.liziflower.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import zut.cs.liziflower.entity.Notice;
import zut.cs.liziflower.mapper.NoticeMapper;
import zut.cs.liziflower.service.INoticeService;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author xuwenke
 * @since 2022-05-21
 */
@Service
@Transactional
public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> implements INoticeService {

    @Resource
    private NoticeMapper noticeMapper;

    @Override
    public List<Notice> getAllNotices() {
        List<Notice> list = noticeMapper.getAllNotices();
        return list;
    }

    @Override
    public Notice getNoticeByNoticeID(Integer noticeid) {
        QueryWrapper<Notice> wrapper = new QueryWrapper<>();
        wrapper.eq("noticeid", noticeid);
        return noticeMapper.selectOne(wrapper);

    }
}
